<template>
  <div class="lism-box">
    <ul class="mui-table-view">
        <!-- 传递对应的id 去往对应的新闻详情页面 -->
      <router-link
        :to="'/son'+val.id"
        tag="li"
        class="mui-table-view-cell mui-media"
        v-for="val in lism"
        :key="val.id"
      >
        <a href="javascript:;" class>
          <img class="mui-media-object mui-pull-left" :src="val.img_url">
          <div class="mui-media-body">
            {{val.title}}
            <p class="mui-ellipsis p-box">
              <span>时间 : {{val.add_time | ctime}}</span>
              <span>点击 : {{val.click}}</span>
            </p>
          </div>
        </a>
      </router-link>
    </ul>
  </div>
</template>
<script>
export default {
  data() {
    return {
      lism: []
    };
  },
  created() {
    this.test();
  },
  methods: {
    test() {
      this.$http.get("api/getnewslist").then(res => {
        this.lism = res.body.message;
      });
    }
  }
};
</script>
 <style lang="less">
    .lism-box {
        .p-box {
            margin-top: 3px;
            display: flex;
            justify-content: space-between;
            font: 12px;
            color: red;
        }
    }
</style>



